// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env:'online-00000'
})
const db=cloud.database()
const _=db.command
// 云函数入口函数
exports.main = async (event, context) => {
  //每日清空报名者和中奖者
  let pro1=await db.collection('joiner').where({_id:_.neq('')}).remove();
  let pro2 = await db.collection('winners').where({ _id: _.neq('')}).remove();
  return{
    join: pro1.stats.removed,
    win:pro2.stats.removed
  }
}